3D Graphics Programming with QuickDraw 3D 1.5.4
Previous | QD3D Book | Overview | Chapter Contents | Next |
Before calling any 3D Viewer routines, you need to verify that the 3D Viewer software is available in the current operating environment. On the Macintosh Operating System, you can verify that the 3D Viewer is available by calling the MyEnvironmentHas3DViewer function defined in Listing 12 .
Listing 12 Determining whether the 3D Viewer is available
long MyEnvironmentHas3DViewer (void)
{
if (Q3ViewerNew != NULL)
return TRUE
else
return FALSE;
}
The MyEnvironmentHas3DViewer function checks whether the address of the Q3ViewerNew function has been resolved. If it hasn't been resolved (that is, if the Code Fragment Manager couldn't find the 3D Viewer shared library when launching your application), MyEnvironmentHas3DViewer returns the value FALSE to its caller. Otherwise, if the address of the Q3ViewerNew function was successfully resolved, MyEnvironmentHas3DViewer returns TRUE .
For the function MyEnvironmentHas3DViewer to work properly, you must establish soft links (also called weak links ) between your application and the 3D Viewer shared library. For information on soft links, see the book Inside Macintosh: PowerPC System Software. For specific information on establishing soft links, see the documentation for your software development system.
On the Macintosh Operating System, you can also verify that the 3D Viewer is available in the current operating environment by calling the Gestalt function with the gestaltQuickDraw3DViewer selector. Gestalt returns a long word whose value indicates the availability of the 3D Viewer. Currently these values are defined:
enum {
gestaltQD3DViewer = 'q3vc',
gestaltQD3DViewerNotPresent = 0,
gestaltQD3DViewerAvailable = 1
}
You should ensure that the value gestaltQD3DViewerAvailable is returned before calling any 3D Viewer routines.
For more information on the Gestalt function, see Inside Macintosh: Operating System Utilities .
Previous | QD3D Book | Overview | Chapter Contents | Next |